package org.example;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-11-10
 * 14:27
 */
class Test{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int startValue=1;
        int sum=0;
        for(int i=0;i<arr.length;i++){
            sum+=arr[i];
            int n1=sum+startValue;
            if(n1<1){
                startValue=1-sum;
            }
        }
        System.out.println(startValue);
    }
}
